{% extends "base.html" %}
{% load crispy_forms_filters %}
{% load i18n %}
{% load crispy_forms_tags %}

{% block title %}{% trans "修改密码" %}{% endblock %}

{% block content %}
<div class="container py-5">
  <div class="row justify-content-center">
    <div class="col-md-6">
      <div class="card shadow">
        <div class="card-header bg-primary text-white">
          <h1 class="h4 mb-0">{% if token_fail %}{% trans "无效的密码重置链接" %}{% else %}{% trans "修改密码" %}{% endif %}</h1>
        </div>
        <div class="card-body">
          {% if token_fail %}
            {% url 'account_reset_password' as passwd_reset_url %}
            <p>{% blocktrans %}该密码重置链接无效，可能是因为它已经被使用。请<a href="{{ passwd_reset_url }}">重新申请密码重置</a>。{% endblocktrans %}</p>
          {% else %}
            {% if form %}
              <form method="POST" action="{{ action_url }}">
                {% csrf_token %}
                {{ form|crispy }}
                <button class="btn btn-primary w-100 mt-3" type="submit">{% trans '修改密码' %}</button>
              </form>
            {% else %}
              <p>{% trans '您的密码已成功修改。' %}</p>
              <div class="text-center mt-3">
                <a href="{% url 'account_login' %}" class="btn btn-primary">{% trans "登录" %}</a>
              </div>
            {% endif %}
          {% endif %}
        </div>
      </div>
    </div>
  </div>
</div>
{% endblock %}

